// 例子37

let colors = ['red', 'yellow', 'blue', 'green'];
for (color of colors) {
    console.log(color); // 前后分别输出"red" "yellow" "blue" "green"
}

colors.forEach((color, index) => {
    console.log([index, color]); // 前后分别输出[0, "red"] [1, "yellow"] [2, "blue"] [3, "green"]
})

for ([index, color] of colors.entries()) {
    console.log([index, color]); // 前后分别输出[0, "red"] [1, "yellow"] [2, "blue"] [3, "green"]
}